package com.etmvc.core;

import org.apache.commons.lang.StringUtils;

import com.et.mvc.Controller;
import com.et.mvc.filter.BeforeFilter;
/**
 * 后台的controller继承该类，走权限校验
 */
@BeforeFilter(execute="auth")
public class ManageController extends Controller{
	protected boolean auth() throws Exception{
		String query = getControllerPath()+"/"+getActionName();
		if (!StringUtils.isEmpty(request.getQueryString())) {
			query+="?"+request.getQueryString();
		}
        if (session.getAttribute("MANAGER") == null){
        	redirect("/auth/login?r="+query);
        	return false;
        }
        System.out.println(session.getAttribute("MANAGER") + ":query->"+query);
		return true;
    }
}
